package cn.funeralobjects.dictms.web.mapper;

import cn.funeralobjects.common.web.controller.converter.ModelMapper;
import cn.funeralobjects.dictms.entity.EDictValue;
import cn.funeralobjects.dictms.model.DictValue;
import cn.funeralobjects.dictms.model.DictValuePathDto;
import cn.funeralobjects.dictms.web.model.MDictValue;
import cn.funeralobjects.dictms.web.model.VDictValue;
import cn.funeralobjects.dictms.web.model.VDictValuePathDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author FuneralObjects
 * Create date: 2020/6/5 10:40 AM
 */
@Mapper(componentModel = "spring")
public interface DictValueMapper extends ModelMapper<MDictValue, DictValue, EDictValue, VDictValue> {

    VDictValuePathDto toVo(DictValuePathDto dto);

    @Mappings({
            @Mapping(target = "dictId", source = "dict.id")
    })
    @Override
    VDictValue toVo(EDictValue eDictValue);

    @Mappings({
            @Mapping(target = "dict.id", source = "dictId")
    })
    @Override
    EDictValue toEntity(VDictValue vDictValue);
}
